package com.wing.productionPlan.enumeration;

public enum AuditStatusEnum {

    PENDING("001", "待审核"),
    IN_PROGRESS("002", "审核中"),
    COMPLETED("003", "已审核"),
    APPROVED("004", "审核通过"),
    REJECTED("005", "审核拒绝"),
    CANCELLED("006", "取消审核");

    private final String code;
    private final String description;

    // 构造函数
    AuditStatusEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    // Getter 方法
    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 通过code查找AuditStatus的方法
    public static AuditStatusEnum getByCode(String code) {
        for (AuditStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("No matching audit status for code: " + code);
    }

    // 可选：如果需要根据code获取description，可以提供此方法
    public static String getDescriptionByCode(String code) {
        AuditStatusEnum status = getByCode(code);
        return status.getDescription();
    }

}
